export default {
    namespaced: true,
    state: {
        // 模态框显示
        isShowToast: false,
        toastMsg: "",
        toastType: ""
    },
    mutations: {
        // 修改模态框
        changeIsShowToast(state, payload) {
            state.isShowToast = payload.isShow
            if (payload.isShow) {
                state.toastMsg = payload.msg,
                    state.toastType = payload.type
            }


        }
    },
    actions: {
        aysncShowToast(context, payload) {
            // console.log("actions---", payload);
            // 显示提示框
            context.commit("changeIsShowToast", payload)
            // 自动关闭提示框
            setTimeout(() => {
                context.commit("changeIsShowToast", {
                    isShow: false
                })
            }, 2000);
        }
    }

}